package top.yaofengqiao.springcloudsimple.auth.biz.domain.security.model;

import lombok.Setter;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import top.yaofengqiao.springcloudsimple.auth.biz.trigger.http.dto.RefreshTokenDTO;

import java.util.Collections;

/**
 * @author yfq
 * @date 2024/6/7 11:49
 * @description
 */
public class RefreshTokenAuthenticationToken extends AbstractAuthenticationToken {
    private final RefreshTokenDTO refreshTokenDTO;
    @Setter
    private UserInfo userInfo;

    public RefreshTokenAuthenticationToken(RefreshTokenDTO refreshTokenDTO) {
        super(Collections.emptyList());
        this.refreshTokenDTO = refreshTokenDTO;
    }

    @Override
    public Object getCredentials() {
        return refreshTokenDTO;
    }

    @Override
    public Object getPrincipal() {
        return userInfo;
    }
}
